package demo5;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Person {
    //@Resource(name = "shirt")//name中指定类名，注意：首字母需要小写，其余后续与类名
    //private Clothes clothes;

    //@Resource
    //private Clothes clothes;//按照类型装配


    @Resource
    private Clothes shirt;//如果属性名与类名一致(仅首字母小写)也可以进行装配

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + shirt +
                '}';
    }
}
